package com.woniu.park.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniu.park.entity.Coupon;
import com.woniu.park.dao.CouponMapper;
import com.woniu.park.entity.User;
import com.woniu.park.service.ICouponService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cxb
 * @since 2020-09-05
 */
@Service
@Slf4j
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService {

    @Autowired
    private CouponMapper couponMapper;
    @Override
    public List<Coupon> discountCoupons(int userId) {
        QueryWrapper<Coupon> couponQueryWrapper = new QueryWrapper<>();
        couponQueryWrapper.eq("user_Id",userId);
        List<Coupon> list =  couponMapper.selectList(couponQueryWrapper);
        log.info("ID为：{}，的用户查；优惠劵：{}",userId,list);
        return list;
    }
}
